//
//  LYPageDemoViewController.m
//  LYKitDemo
//
//  Created by Mac-Mini-KingVision on 16/2/22.
//  Copyright © 2016年 LiuWenYang. All rights reserved.
//

#import "LYPageDemoViewController.h"
#import "LYCollectionPageViewController.h"
#import "Masonry.h"

@interface LYPageDemoViewController ()<LYCollectionPageViewControllerDelegate>

/** <#注释#> */
@property (nonatomic,strong) LYCollectionPageViewController *pageViewController;
@property (nonatomic, strong) UIView *blueView;

@end

@implementation LYPageDemoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self addChildViewController:self.pageViewController];
    [self.view addSubview:self.pageViewController.view];
    
    [self.pageViewController.view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.leading.trailing.bottom.equalTo(self.view);
    }];
    // Do any additional setup after loading the view.
}

-(LYCollectionPageViewController *)pageViewController
{
    if (_pageViewController == nil) {
        _pageViewController = [[LYCollectionPageViewController alloc] init];
        
        _blueView = [[UIView alloc] init];
        _blueView.backgroundColor = [UIColor blueColor];
        
        UIView *redView = [[UIView alloc] init];
        redView.backgroundColor = [UIColor redColor];
        
        UIView *yellow = [[UIView alloc] init];
        yellow.backgroundColor = [UIColor yellowColor];
        
        [_pageViewController setUpWithViews:@[_blueView,redView,yellow]];
        _pageViewController.delegate = self;
    }
    return _pageViewController;
}

-(void)lyCollectionPageViewController:(LYCollectionPageViewController *)collectionPageViewController currentPage:(NSInteger)currentPage
{
    if (currentPage == 1) {
        _blueView.backgroundColor = [UIColor orangeColor];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
